<template>
    <view class="cont">
		<view class="box">
			<text></text>
		</view>
		<view class="box1">
			<l-dialer class="zhuanpan" size="300" :prizeList="state.prizeList" @click="onClick" @done="onDone" ref="dialer">
				<image class="bg" src="./zhuan2_1.png"></image>
				<!-- <template #pointer>
					<view>这是指针</view>
				</template> -->
			</l-dialer>
		</view>
    </view>
</template>
<script setup>
import { Tl_msg } from '@/common/tools';
import { onLoad } from '@dcloudio/uni-app';
import { defineComponent,ref,reactive,onMounted } from 'vue'
const dialer = ref(null);
let ajaxState = false;
const state = reactive({
	prizeList:[
		{
			id: 'coupon88',
			name: '咸肉菜饭',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/175718/35/12595/5477/60b660c6Eb850717b/a1cfe750dcdb5b78.png',
		},
		{
			id: 'coupon900',
			Color: 'rgb(251, 219, 216)',
			name: '老四',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/190845/9/6092/4489/60b65fe8Ebb8f8284/955da889f6d1c13e.png',
		},
		{
			id: 'coupon1',
			name: '快餐',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/189927/14/6092/4174/60b66173E23c472ea/44af15a151defca1.png',
		},
		{
			id: 'apple',
			Color: 'rgba(246, 142, 46, 0.5)',
			name: '烩面',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/177670/26/4591/2514/60a25874Ee0e5332a/99c7bdfede732ae4.png'
		},
		{
			id: '545646',
			name: '襄县焖面',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/124578/12/20170/4429/60b635d8E7089ebb0/7a47d76a2a260cc0.png'
		},
		{
			id: 'sdadasdd',
			name: '重庆盖浇饭',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/124578/12/20170/4429/60b635d8E7089ebb0/7a47d76a2a260cc0.png'
		},
		{
			id: 'hyh',
			name: '鲁山揽锅菜',
			// img: 'https://img11.360buyimg.com/pop/jfs/t1/124578/12/20170/4429/60b635d8E7089ebb0/7a47d76a2a260cc0.png'
		}
	]
})
const onClick = ()=>{
	if(ajaxState){return;};
	ajaxState = true;
	let suiji = Math.floor(state.prizeList.length*Math.random())
	dialer.value.run(suiji)
}
const onDone = (index)=>{
	const data = state.prizeList[index];
	// Tl_msg({

	// })
	uni.showModal({
		title: '今天吃'+data.name,
		// content: (prize.id !== 'thanks' ? `获得`:'') + prize.name
	})
	ajaxState = false;
	console.log('中奖到第几个',index)
}
onLoad(()=>{
	uni.setNavigationBarTitle({
		title:'今天中午吃什么?'
	})
})
</script>
<style lang="scss">
.cont{
	flex-direction: column;
	.box{
		text-align: center;
		justify-content: center;
		margin: 10rpx;
	}
}
.box1{
	width: 750rpx;
	height: 750rpx;
	margin-top: 30rpx;
	flex-direction: row;
	justify-content: center;
	.zhuanpan{
		/* background-color: green; */
		display: block;
		margin-left:auto;
		margin-right: auto;
		/* background-image: url("./zhuan2_1.png"); */
	}
}
</style>